Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't fire missing act() warnings for react-art #15975

Merged

Conversation

threepointone
Copy link
Contributor

@threepointone threepointone commented Jun 24, 2019

react-art is a renderer that's usually embedded inside other renderer trees (like react-dom, etc) we fire a warning for being wrapped in the 'wrong' renderer's act. For an embedded usecase like react-art, this would mean you'd always see the warning. we could expose a new act() for react-art, but really we just want embedded renderers to not trigger the warning.

  • the first commit just fixes test infra for fixtures/dom (forking toWarnDev into itself)

  • the second commit is mostly what we're interested in 88fe0b4. For 'secondary' renderers like react-act, we don't want to fire missing act() warnings; the wrapping renderer will fire warnings anyway, and when it flushes, it flushes effects across renderers.

  • I could have used isPrimaryRenderer as the flag, but this is marked as false for react-test-renderer, and we do want the warning to fire for it. Hence a new flag.

  • I'm open to a new name for shouldWarnUnactedUpdates.

forks toWarnDev from root into fixture/dom, updates tes tests to use it
- For 'secondary' renderers like react-act, we don't want to fire missing act() warnings; the wrapping renderer will fire warnings anyway, and when it flushes, it flushes effects *across* renderers.

- I could have used isPrimaryRenderer as the flag, but this is marked as false for react-test-renderer, and we *do* want the warning to fire for it. Hence a new flag.
@sizebot
Copy link

sizebot commented Jun 24, 2019

No significant bundle size changes to report.

Generated by 🚫 dangerJS

@threepointone threepointone merged commit fce15f1 into facebook:master Jun 24, 2019
rickhanlonii pushed a commit to rickhanlonii/react that referenced this pull request Jun 25, 2019
* use toWarnDev for dom fixture tests

forks toWarnDev from root into fixture/dom, updates tes tests to use it

* disable act() warnings for react-art()

- For 'secondary' renderers like react-act, we don't want to fire missing act() warnings; the wrapping renderer will fire warnings anyway, and when it flushes, it flushes effects *across* renderers.

- I could have used isPrimaryRenderer as the flag, but this is marked as false for react-test-renderer, and we *do* want the warning to fire for it. Hence a new flag.

* add missing dependency `art` to fixtures/dom
NMinhNguyen referenced this pull request in enzymejs/react-shallow-renderer Jan 29, 2020
* use toWarnDev for dom fixture tests

forks toWarnDev from root into fixture/dom, updates tes tests to use it

* disable act() warnings for react-art()

- For 'secondary' renderers like react-act, we don't want to fire missing act() warnings; the wrapping renderer will fire warnings anyway, and when it flushes, it flushes effects *across* renderers.

- I could have used isPrimaryRenderer as the flag, but this is marked as false for react-test-renderer, and we *do* want the warning to fire for it. Hence a new flag.

* add missing dependency `art` to fixtures/dom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants